package com.eastfair.imaster.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.core.base.entity.Entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

/**
 * <p>
 * 实体类
 * 意见反馈
 * </p>
 *
 * @author zjn
 * @since 2021-11-10
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("o_suggest")
@ApiModel(value = "Suggest", description = "意见反馈")
@AllArgsConstructor
public class Suggest extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 用户id
     */
    @ApiModelProperty(value = "用户id")
    @TableField(value = "user_id")
    @Excel(name = "用户id")
    private Long userId;

    /**
     * 反馈内容
     */
    @ApiModelProperty(value = "反馈内容")
    @Size(max = 512, message = "反馈内容长度不能超过512")
    @TableField(value = "content", condition = LIKE)
    @Excel(name = "反馈内容")
    private String content;

    /**
     * 回复内容
     */
    @ApiModelProperty(value = "回复内容")
    @Size(max = 512, message = "回复内容长度不能超过512")
    @TableField(value = "reply_content", condition = LIKE)
    @Excel(name = "回复内容")
    private String replyContent;

    /**
     * 回复时间
     */
    @ApiModelProperty(value = "回复时间")
    @TableField(value = "reply_time")
    @Excel(name = "回复时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime replyTime;

    /**
     * 用户身份
     */
    @ApiModelProperty(value = "用户身份")
    @Size(max = 32, message = "用户身份长度不能超过32")
    @TableField(value = "subject_type", condition = LIKE)
    @Excel(name = "用户身份")
    private String subjectType;

    /**
     * 是否启用：1是；0否
     */
    @ApiModelProperty(value = "是否启用：1是；0否")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用：1是；0否")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;


    @Builder
    public Suggest(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Long projectId, Long userId, String content, String replyContent, LocalDateTime replyTime, 
                    String subjectType, Integer isEnabled, Integer isDeleted) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.projectId = projectId;
        this.userId = userId;
        this.content = content;
        this.replyContent = replyContent;
        this.replyTime = replyTime;
        this.subjectType = subjectType;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
    }

}
